<template>
	<view style="padding: 30rpx 20rpx;">
		<scroll-view :scroll-y="true" style="position: relative;top: 70rpx;">
			<view class="invBox" v-for="(item,index) in consentList" :key="index" @click="shopClick(item.id,item.title)">
				<view class="invTop flex-sbc">
					<view class="left">
						<image :src="item.user.userUrl" style="width: 60rpx;height: 60rpx;border-radius: 50%;"></image>
						<text>{{item.user.username}}</text>
					</view>
					<view class="right">
						<u-icon name="eye-fill" color="#C8C9CC" size="28"></u-icon>
						<text style="margin-left: 15rpx;">{{item.look}}</text>
					</view>
				</view>
				<view class="title">{{item.title}}</view>
				<view class="cosntent">
					{{item.content}}
				</view>
				<view class="cosntent">
					<text style="color: red;">￥{{item.price}}</text>
					<text style="color: #2979FF;margin-left: 30rpx;">求购量：{{item.shopNum}}</text>
				</view>
				<view class="time">发布时间：{{item.creatTime}}</view>
				<view class="Image">
					<view class="ImageBox">
						<image :src="res" v-for="(res,x) in item.fUrl" :key="x" v-if="item.fUrl.length > 0"></image>
						<image :src="item.shopUrl" v-if="item.fUrl.length == 0 && item.fileUrl!=''"></image>
					</view>
				</view>
			</view>
		</scroll-view>
		<view style="height: 30rpx;"></view>
	</view>
</template>

<script>
	import helper from '../../common/helper.js'
	export default {
		data() {
			return {
				src: 'https://lwzeng.oss-cn-beijing.aliyuncs.com/0ab58592ff924d1a9381c0da2916c5701FNqRNajTIYq8cc8c68c56c826787a12afe948d59319.jpg',
				consentList:[]
			}
		},
		created() {
			this.getConsent()
		},
		methods: {
			shopClick(id,title){
				uni.navigateTo({
					url: '../invitation/shopMe?id=' + id + '&title=' + title
				})
			},
			getConsent(){
				let that = this
				let data = {
					query: '',
					pageNum: 1,
					pageSize: -1,
					userId: '',
					consentId: ''
				}
				that.getRequest(helper.getConsent,data).then(res => {
					if(res.data.flag == "200"){
						let serve = res.data.consentList
						that.getConsent = []
						serve.forEach((item,index) => {
							if(item.shopUrl.indexOf("<<tupian>>") > 0){
								item.shopUrl = item.shopUrl.split("<<tupian>>")
								// console.log(index)
								let obj = item.shopUrl
								that.$set(item,'fUrl',obj)
								// console.log(obj)
							}else{
								let obj = []
								that.$set(item,'fUrl',obj)
							}
							item.creatTime = that.formatDateTime(item.creatTime)
							// console.log(item.shopUrl)
							that.consentList.push(item)
						})
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.invBox{
	background-color: #FFFFFF;
	border-radius: 16rpx;
	padding: 15rpx;
	margin-bottom: 30rpx;
	.invTop{
		.left{
			display: flex;
			align-items: center;
			text{
				font-size: 28rpx;
				font-weight: bold;
				margin-left: 15rpx;
			}
		}
		.right{
			display: flex;
			align-items: center;
			color: #C8C9CC;
			font-size: 24rpx;
		}
	}
	.title{
		margin-top: 15rpx;
		font-size: 36rpx;
		font-weight: bold;
	}
	.cosntent{
		font-size: 30rpx;
		// color: #C8C9CC;
		margin-top: 15rpx;
	}
	.Image{
		margin-top: 15rpx;
		.ImageBox{
			image{
				width: 150rpx;
				height: 150rpx;
				border-radius: 8rpx;
				margin-right: 15rpx;
				// border: 1rpx #C8C9CC solid;
			}
		}
	}
	.time{
		// color: #C8C9CC;
		font-size: 26rpx;
		margin-top: 15rpx;
	}
}
</style>
